package com.bestcem.xm.ticket.entity.mongo;

import com.alibaba.fastjson.JSONObject;
import com.bestcem.xm.ticket.constant.ColumnConstant;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.Date;
import java.util.List;

/**
 * 记录触发预警/工单规则的 问卷项目、触发的规则、答卷数据等信息
 * 一个工单对应一条记录
 *
 * @author liheng
 * @version v1.0
 * @date 2021/8/16 16:04
 */
@EqualsAndHashCode(callSuper = true)
@Data
public class Record extends BaseEntity {

    private static final long serialVersionUID = -3578092062110162825L;
    /**
     * 公司ID
     */
    @JsonProperty(value = ColumnConstant.Record.ORG_ID)
    private String orgId;

    /**
     * 预警生成方式
     *
     * @see com.bestcem.xm.ticket.enums.RecordModeEnum
     */
    @JsonProperty(value = ColumnConstant.Record.MODE)
    private Integer mode;

    /**
     * 问卷系统ID
     */
    @JsonProperty(value = ColumnConstant.Record.QPROJECT_ID)
    private String qProjectId;

    /**
     * 答卷编号
     */
    @JsonProperty(value = ColumnConstant.Record.RSPD_SEQ)
    private Long rspdSeq;

    /**
     * 预警编号 ="A"+str(rspdSeq)
     */
    @JsonProperty(value = ColumnConstant.Record.ALERT_SEQ)
    private String alertSeq;

    /**
     * 答卷归属组及其祖先组
     */
    @JsonProperty(value = ColumnConstant.Record.GROUP_LIST)
    private List<String> groupList;

    /**
     * 答卷归属组编码
     */
    @JsonProperty(value = ColumnConstant.Record.GROUP_CODE)
    private String groupCode;

    /**
     * 触发的规则的condition
     */
    @JsonProperty(value = ColumnConstant.Record.RULE_LIST)
    private List<TicketRule.Condition> ruleList;


    /**
     * 预警关闭时间
     */
    @JsonProperty(value = ColumnConstant.Record.CLOSE_DT)
    private Date closeDate;

    /**
     * 预警关闭原因
     *
     * @see com.bestcem.xm.ticket.enums.RecordCloseReasonEnum
     */
    @JsonProperty(value = ColumnConstant.Record.CLOSE_REASON)
    private Integer closeReason;

    /**
     * 触发预警的内容
     */
    @JsonProperty(value = ColumnConstant.Record.DATA)
    private JSONObject data;

    /**
     * 是否sample
     */
    @JsonProperty(value = ColumnConstant.Record.SAMPLE)
    private Boolean sample;
}
